import service from '@/utils/request'

// @Summary 用户登录
// @Produce  application/json
// @Param data body {username:"string",password:"string"}
// @Router /base/login [post]
export const getFarmList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/farm/farm-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addFarm = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/farm/farm-add',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editFarm = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/farm/farm-edit',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getFarmDetail = (farmId) => {
  return new Promise((resolve,reject)=>{
    service.get(`/boss/farm/farm-get?farmId=${farmId}`)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getCompanyList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/tanc-company/tanc-company-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addCompany = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/tanc-company/tanc-company-add',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const delCompany = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/tanc-company/tanc-company-delete',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getTeamList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/team/team-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addTeam = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/team/add-team-member',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editTeam = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/team/team-member-edit',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getTeamDetail = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/team/team-member-detail',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getUserList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/boss-user/boss-user-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addUser = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/boss-user/boss-user-add',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editUser = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/boss-user/boss-user-edit',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getRoleList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/role/role-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addRole = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/role/role-add',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editRole = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/role/role-edit',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const delRole = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/role/role-delete',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getNotifyList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/notify/sys-notify-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getTeamRoleList = () => {
  return new Promise((resolve,reject)=>{
    service.get('/boss/team/team-role-list')
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addNotify = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/notify/sys-notify-add',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const editNotify = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/notify/sys-notify-edit',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const addNotifyDetail = (notifyId) => {
  return new Promise((resolve,reject)=>{
    service.get(`/boss/notify/sys-notify-get?notifyId=${notifyId}`)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const delNotify = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/notify/sys-notify-delete',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const sendNotify = (notifyId) => {
  return new Promise((resolve,reject)=>{
    service.get(`/boss/notify/farming-advice-send?notifyId=${notifyId}`)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getFeedbacksList = (data) => {
  return new Promise((resolve,reject)=>{
    service.post('/boss/user-feedbacks/user-feedbacks-list',data)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const getFeedbacksDetail = (feedbackId) => {
  return new Promise((resolve,reject)=>{
    service.get(`/boss/user-feedbacks/user-feedbacks-get?feedbackId=${feedbackId}`)
    .then(res=>{
      resolve(res.data) 
    })
  })
}

export const updateTeamStatus = (params) => {
  return service({
    url: `/boss/team/change-status`,
    method: 'get',
    params
  })
}

export const updateFarmStatus = (params) => {
  return service({
    url: `/boss/farm/change-farm-status`,
    method: 'get',
    params
  })
}

export const updateRoleStatus = (params) => {
  return service({
    url: `/boss/role/change-role-status`,
    method: 'get',
    params
  })
}